unit kwCommonDm;

interface

uses
  SysUtils, Classes, InstantPersistence, InstantBrokers, InstantXML, DB, Forms,
  kwStrings, kwModel;

type
  TkwCommonData = class(TDataModule)
    faXMLDatabase: TXMLFilesAccessor;
    icXMLConnector: TInstantXMLConnector;
    procedure DataModuleCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  kwCommonData: TkwCommonData;

implementation

{$R *.dfm}

procedure TkwCommonData.DataModuleCreate(Sender: TObject);
var
  APath : string;
begin
  APath := Format('%s%s', [ExtractFilePath(Application.ExeName), 'Data\']);
  if not DirectoryExists(APath) then
    raise Exception.Create(Format(rsfmtDataPathNotFound, [APath]))
  else
  try
    faXMLDatabase.RootFolder := APath;
    icXMLConnector.Connect;
  except
    raise Exception.Create(rsConnectionFailed);
  end;
end;

end.
